package logic

import (
	"activity_srv/activity"
	"activity_srv/internal/dao"
	"activity_srv/internal/svc"
	"context"
	"go.uber.org/zap"
	"smart-health-platforms/pkg"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetGeneratePosterLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGetGeneratePosterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetGeneratePosterLogic {
	return &GetGeneratePosterLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 海报列表
func (l *GetGeneratePosterLogic) GetGeneratePoster(in *activity.GetGeneratePosterReq) (*activity.GetGeneratePosterResponse, error) {
	//业务逻辑
	posterList, err := dao.GetGeneratePoster(in)
	if err != nil {
		pkg.Error("获取海报列表失败", zap.Error(err))
		return nil, err
	}
	pkg.Info("获取海报列表成功", zap.Any("posterList", posterList))

	return &activity.GetGeneratePosterResponse{
		List: posterList,
	}, nil
}
